﻿using System;
using UnityEngine;

// Token: 0x02000211 RID: 529
public class SharedKnowledge : IListener
{
	// Token: 0x06000B2E RID: 2862 RVA: 0x0005E7ED File Offset: 0x0005C9ED
	public SharedKnowledge()
	{
		EventManager.Register(this, EventCode.OnCrush);
		this.dangerEntity = GameController.playerInstance;
	}

	// Token: 0x06000B2F RID: 2863 RVA: 0x0005E818 File Offset: 0x0005CA18
	public void OnNotify(IEvent e)
	{
		CrushEvent crushEvent = (CrushEvent)e;
		if (crushEvent.crusher != null)
		{
			this.dangerEntity = crushEvent.crusher;
		}
	}

	// Token: 0x06000B30 RID: 2864 RVA: 0x0005E84C File Offset: 0x0005CA4C
	public float CheckDanger(EntityBase agent)
	{
		float num = 0f;
		if (this.dangerEntity == null)
		{
			return num;
		}
		float num2 = (this.dangerEntity.Height - agent.Height) * this.baseRadius;
		Vector3 vector = agent.transform.position - this.dangerEntity.transform.position;
		vector.y = 0f;
		float magnitude = vector.magnitude;
		num = 1f - magnitude / num2;
		return Mathf.Clamp01(num * 4f);
	}

	// Token: 0x04001049 RID: 4169
	public EntityBase dangerEntity;

	// Token: 0x0400104A RID: 4170
	private float baseRadius = 1.5f;
}
